//This file is part of o-RSA.
//
//o-RSA is free software: you can redistribute it and/or modify
//it under the terms of the GNU Lesser General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//o-RSA is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Lesser General Public License for more details.
//
//You should have received a copy of the GNU Lesser General Public License
//along with o-RSA.  If not, see <http://www.gnu.org/licenses/>.

#include "o-RSA/bigInt/BigIntegerLibrary.hh"
#include "o-RSA/o-RSA.h"
#include <string>
#include <iostream>
using namespace std;
#define Bunt BigUnsigned

string usage =
"o-RSA is free software: you can redistribute it and/or modify\n"
"it under the terms of the GNU Lesser General Public License as published by\n"
"the Free Software Foundation, either version 3 of the License, or\n"
"(at your option) any later version.\n"
"\n"
"o-RSA is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
"GNU Lesser General Public License for more details.\n"
"\n"
"You should have received a copy of the GNU Lesser General Public License\n"
"along with o-RSA.  If not, see <http://www.gnu.org/licenses/>.\n"
"\n"
"\n"
"usage: orsa <key length in bits> <output filename>\n"
"orsa command line RSA keygen, version 1.0.0.\n"
"For support contact justin.seely@gmail.com\n";

int main(int argc, char* argv[]){

	/*****************************************************
	*
	* This file is only used to test the o_RSA library
	* if you want to use this library add the o-RSA folder
	* to your project and then include both o-RSA/o-RSA.h
	* and o-RSA\bigInt\BigIntegerLibrary.hh
	*
	*******************************************************/

	Bunt bits;
	string filename;
	if(argc == 3){
		bits = atoi(argv[1]);
		filename = argv[2];
	}else if(argc == 1){
		long unsigned temp;
		cout << "Please specify the size of key you would like to create: ";
		cin >> temp;
		bits = temp;
		cout << "Please specify output filename: ";
		cin >> filename;
	}else if(argc == 2 && argv[1][0] == '-' && argv[1][1] == 'h'){
		cout << usage << endl;
		return 1;
	}else{
		cout << "Invalid arguments!" << endl;
		return 1;
	}
	o_RSA::generateKeys(filename, bits);
	return 0;
}
